<template>
  <div class="app-container">
    <div v-if="isShow == '钢轨'">
      <el-form :model="queryParams" ref="queryRef" :inline="true">
        <el-form-item label="">
          <el-select
            filterable
            v-model="queryParams.railwayId"
            placeholder="路线"
            clearable
            style="width: 140px"
          >
            <el-option
              v-for="dict in railwayNamearr"
              :key="dict.railwayName"
              :label="dict.railwayName"
              :value="dict.railwayId"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="">
          <el-select
            filterable
            clearable
            style="width: 140px"
            v-model="queryParams.stationId"
            placeholder="车站名"
          >
            <el-option
              v-for="dict in stationNamearr"
              :label="dict.stationName"
              :value="dict.stationId"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="" class="formitemcla">
          <el-input
            v-model="queryParams.startMileageNumber"
            placeholder="起点里程"
            clearable
            style="width: 140px"
          >
            <template #suffix> km </template>
          </el-input>
        </el-form-item>
        <el-form-item label="~">
          <el-input
            v-model="queryParams.endMileageNumber"
            placeholder="终点里程"
            clearable
            style="width: 140px"
          >
            <template #suffix> km </template>
          </el-input>
        </el-form-item>
        <el-form-item label="">
          <el-input
            v-model="queryParams.railCode"
            placeholder="钢轨编号"
            clearable
            style="width: 140px"
          />
        </el-form-item>
        <el-form-item label="">
          <el-select
            filterable
            v-model="queryParams.railWeightId"
            placeholder="钢轨单重"
            clearable
            style="width: 140px"
          >
            <el-option
              v-for="dict in railWeightarr"
              :key="dict.value"
              :label="dict.railWeight"
              :value="dict.railWeightId"
            />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="queryList" style="width: 80px"
            >查询</el-button
          >
          <el-button @click="resetQuery" style="width: 80px">重置</el-button>
          <el-button type="primary" style="width: 80px" @click="handleExport"
            >导出</el-button
          >
          <el-button type="primary" @click="handleAdd" style="width: 80px"
            >新增</el-button
          >
        </el-form-item>
      </el-form>
      <!-- 表格数据 -->
      <el-table
        v-loading="loading"
        :data="railList"
        height="62vh"
        border
        @selection-change="selectiontab"
      >
        <el-table-column type="selection" label="全选" />
        <el-table-column label="序号" type="index" />
        <el-table-column label="线路" prop="railwayName" />
        <el-table-column label="车站名" prop="stationName" />
        <el-table-column label="股道名称" prop="trackCode" />
        <el-table-column label="起点里程" prop="startMileage" />
        <el-table-column label="终点里程" prop="endMileage"> </el-table-column>
        <el-table-column label="钢轨编号" prop="railCode"> </el-table-column>
        <el-table-column label="股别" prop="stockType"> </el-table-column>
        <el-table-column label="钢轨单重" prop="railWeight"></el-table-column>
        <el-table-column label="钢种" prop="steelType"></el-table-column>
        <el-table-column label="直接数据" min-width="110">
          <template #default="scope" class="buttontext">
            <el-button link type="primary" @click="handleUpdate(scope.row)"
              >参数</el-button
            >
            <el-button link type="primary" @click="meansFun(scope.row)"
              >资料</el-button
            >
          </template>
        </el-table-column>
        <el-table-column label="关联数据" min-width="210">
          <template #default="scope" class="buttontext">
            <el-button link type="primary" @click="resumeUpdate(scope.row)"
              >作业履历</el-button
            >
            <el-button link type="primary" @click="deviceProblem(scope.row)"
              >设备问题</el-button
            >
            <el-button link type="primary" @click="businessFinance(scope.row)"
              >业财</el-button
            >
          </template>
        </el-table-column>
        <el-table-column label="关联设备" min-width="210">
          <template #default="scope" class="buttontext">
            <el-button link type="primary" @click="sleeperfun(scope.row)"
              >轨枕
            </el-button>
            <el-button link type="primary" @click="fasteningfun(scope.row)"
              >扣件
            </el-button>
            <el-button link type="primary" @click="boltfun(scope.row)"
              >螺栓
            </el-button>
            <!-- <el-button link type="primary" @click="guardRailfun(scope.row)">桥上护轨 </el-button> -->
          </template>
        </el-table-column>
        <el-table-column label="操作" min-width="70">
          <template #default="scope" class="buttontext">
            <el-button link type="primary" @click="handleDelete(scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>

    <sleeper
      ref="sleeperRef"
      :forma="forma"
      :className="isShow"
      v-if="isShow == '轨枕'"
      :childValuefun="childValue"
      v-bind="$attrs"
      v-on="$listeners"
    ></sleeper>
    <fastening
      ref="fasteningRef"
      :forma="forma"
      :className="isShow"
      v-if="isShow == '扣件'"
      :childValuefun="childValue"
      v-bind="$attrs"
      v-on="$listeners"
    ></fastening>
    <bolt
      ref="boltRef"
      :forma="forma"
      :className="isShow"
      v-if="isShow == '螺栓'"
      :childValuefun="childValue"
      v-bind="$attrs"
      v-on="$listeners"
    ></bolt>
    <!-- <guardRail
      ref="guardRailRef"
      :forma="forma"
      :className="isShow"
      v-if="isShow == '桥上护轨'"
      :childValuefun="childValue"
      v-bind="$attrs"
      v-on="$listeners"
    ></guardRail> -->
    <!-- 添加或修改用户配置对话框 -->
    <el-dialog
      draggable
      title="作业履历"
      v-model="resumeopen"
      width="1200px"
      style="height: 800px; overflow: auto; margin-top: 5px"
      append-to-body
    >
      <resume></resume>
    </el-dialog>
    <el-dialog
      draggable
      title="资料"
      v-model="meansopen"
      width="1300px"
      append-to-body
      @close="closefun"
    >
      <means :forma="formam" parentName="站内钢轨" v-if="meansopen"></means>
    </el-dialog>
    <el-dialog
      draggable
      :title="title"
      v-model="open"
      width="1200px"
      append-to-body
    >
      <el-form :model="forma" :rules="rules" ref="userRef" label-width="90px">
        <div class="divflex">
          <span class="leftx"></span>
          <span class="mainz">位置</span>
          <span class="rightx"></span>
        </div>
        <el-row>
          <el-col :span="6">
            <el-form-item label="单位名称" prop="unitId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.unitId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in unitNameobj"
                  :label="dict.unitName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="线名" prop="railwayId">
              <el-select
                @change="updateproperyfun(forma.railwayId, true)"
                filterable
                clearable
                style="width: 180px"
                v-model="forma.railwayId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in railwayNameobj"
                  :label="dict.railwayName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="车站名" prop="stationId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.stationId"
                placeholder="请选择"
                @change="updateproperyfun()"
              >
                <el-option
                  v-for="dict in stationNameobj"
                  :label="dict.stationName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="股道名称" prop="trackId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.trackId"
                placeholder="请输入"
                @change="updateproperyfun()"
              >
                <el-option
                  v-for="dict in trackListobj"
                  :label="dict.trackCode"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="起点里程" prop="startMileageNumber">
              <el-input
                @blur="updateproperyfun()"
                type="number"
                style="width: 180px"
                v-model="forma.startMileageNumber"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="终点里程" prop="endMileageNumber">
              <el-input
                @blur="updateproperyfun()"
                type="number"
                style="width: 180px"
                v-model="forma.endMileageNumber"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="钢轨编号" prop="railCode">
              <el-input
                style="width: 180px"
                v-model="forma.railCode"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="股别" prop="stockTypeId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.stockTypeId"
                placeholder="请选择"
              >
                <el-option
                  v-for="(item, index) in stockTypeobj"
                  :key="index"
                  :label="item.propertyName"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="所处位置">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.locationId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in locationobj"
                  :key="dict.propertyName"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="轨件位置">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.railLocationId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in railLocationobj"
                  :key="dict.propertyName"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <div class="divflex">
          <span class="leftx"></span>
          <span class="mainz">特性</span>
          <span class="rightx"></span>
        </div>
        <el-row>
          <el-col :span="6">
            <el-form-item label="线路类型">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.railwayType"
                placeholder="请选择"
                disabled
              >
                <el-option
                  v-for="dict in railwayTypeobj"
                  :key="dict.propertyName"
                  :label="dict.propertyName"
                  :value="dict.propertyName"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="轨距类型">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.gaugeTypeId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in gaugeTypeobj"
                  :key="dict.id"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="单根轨长(米)">
              <el-input
                type="number"
                style="width: 180px"
                v-model="forma.railLength"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="线路设备代码">
              <el-input
                style="width: 180px"
                v-model="forma.lineFacilityCode"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="钢轨ERP编码">
              <el-input
                style="width: 180px"
                v-model="forma.railErpCode"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="标准号" prop="standardNumber">
              <el-input
                style="width: 180px"
                v-model="forma.standardNumber"
                placeholder="请输入标准号"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="钢轨单重" prop="railWeightId">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.railWeightId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in railWeightobj"
                  :key="dict.propertyName"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="钢轨材质">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.railMaterialId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in railMaterialobj"
                  :key="dict.propertyName"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="钢轨种类">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.railTypeId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in railTypeobj"
                  :key="dict.propertyName"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="钢种" prop="steelType">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.steelTypeId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in steelTypeobj"
                  :key="dict.propertyName"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="生产厂" prop="manufacturingPlant">
              <el-input
                style="width: 180px"
                v-model="forma.manufacturingPlant"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="制造年度" prop="manufacturingYear">
              <el-date-picker
                style="width: 180px"
                format="YYYY/MM/DD"
                value-format="YYYY/MM/DD"
                v-model="forma.manufacturingYear"
                type="datetime"
                placeholder="请输入制造年度"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="是否再用轨" prop="railIsAgain">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.railIsAgain"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in railIsAgainobj"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="热处理类型">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.heatTreatmentTypeId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in heatTreatmentTypeobj"
                  :key="dict.propertyName"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="截面类型">
              <el-select
                filterable
                clearable
                style="width: 180px"
                v-model="forma.sectionTypeId"
                placeholder="请选择"
              >
                <el-option
                  v-for="dict in sectionTypeobj"
                  :key="dict.propertyName"
                  :label="dict.propertyName"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="钢轨廓形">
              <el-input
                style="width: 180px"
                v-model="forma.railSilhouette"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="截面面积">
              <el-input
                style="width: 180px"
                v-model="forma.sectionAcreage"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="截面系数">
              <el-input
                style="width: 180px"
                v-model="forma.sectionFactor"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="抗拉强度">
              <el-input
                style="width: 180px"
                v-model="forma.strengthOfExtension"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="通过总重" prop="passingWeight">
              <el-input
                style="width: 180px"
                v-model="forma.passingWeight"
                placeholder="请输入通过总重"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <div class="divflex">
          <span class="leftx"></span>
          <span class="mainz">相关特性</span>
          <span class="rightx"></span>
        </div>
        <el-row>
          <el-col :span="6">
            <el-form-item label="曲线方向">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.curveDirection"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="曲线半径(m)">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.curveRadius"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="转向角">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.steeringAngle"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="超高">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.superelevation"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="起点切线长">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.startTangentLength"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="起缓和线长">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.startMitigateLength"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="终缓和线长">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.endMitigateLength"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="终点切线长">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.endTangentLength"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="曲线全长">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.curveTotalLength"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="坡型">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.slopeType"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="坡度">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.slope"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="坡长">
              <el-input
                style="width: 180px"
                disabled
                v-model="forma.slopeLength"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <div class="divflex">
          <span class="leftx"></span>
          <span class="mainz">静态检测</span>
          <span class="rightx"></span>
        </div>
        <el-row>
          <el-col :span="6">
            <el-form-item label="钢轨表面局部病害长度">
              <el-input
                style="width: 180px"
                v-model="forma.diseaseLength"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="钢轨头部垂直磨耗长度">
              <el-input
                style="width: 180px"
                v-model="forma.verticalAbrasionLength"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="钢轨头部侧面磨耗长度">
              <el-input
                style="width: 180px"
                v-model="forma.sideAbrasionLength"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="钢轨头部总磨耗长度">
              <el-input
                style="width: 180px"
                v-model="forma.totalAbrasionLength"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="轨枕间距">
              <el-input
                style="width: 180px"
                v-model="forma.sleeperDistance"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="轨枕失效数量">
              <el-input
                style="width: 180px"
                v-model="forma.sleeperFailureRateNumber"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="轨枕空吊率">
              <el-input
                style="width: 180px"
                v-model="forma.sleeperAirHangRate"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="轨下垫板失效率">
              <el-input
                style="width: 180px"
                v-model="forma.subplateFailureRate"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="一级伤损数量">
              <el-input
                style="width: 180px"
                v-model="forma.firstInjuryNumber"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="二级伤损数量">
              <el-input
                style="width: 180px"
                v-model="forma.secondInjuryNumber"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="三级伤损数量">
              <el-input
                style="width: 180px"
                v-model="forma.thirdInjuryNumber"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="轨距">
              <el-input
                style="width: 180px"
                v-model="forma.gauge"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="高低">
              <el-input
                style="width: 180px"
                v-model="forma.heightLow"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="轨向">
              <el-input
                style="width: 180px"
                v-model="forma.railDirection"
                placeholder="请输入用户"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="重心距离/至轨底">
              <el-input
                style="width: 180px"
                v-model="forma.centroidalDistanceBottom"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="重心距离/至轨顶">
              <el-input
                style="width: 180px"
                v-model="forma.centroidalDistanceTop"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="惯性矩">
              <el-input
                style="width: 180px"
                v-model="forma.inertiaMoment"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="斜度">
              <el-input
                style="width: 180px"
                v-model="forma.inclination"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <div class="divflex">
          <span class="leftx"></span>
          <span class="mainz">健康度</span>
          <span class="rightx"></span>
        </div>
        <el-row>
          <el-col :span="6">
            <el-form-item label="健康值">
              <el-input
                style="width: 180px"
                v-model="forma.healthIndex"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="隐患等级">
              <el-input
                style="width: 180px"
                v-model="forma.hiddenDangerLevel"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="伤损程度">
              <el-input
                style="width: 180px"
                v-model="forma.degreeOfInjury"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="设备使用频率">
              <el-input
                style="width: 180px"
                v-model="forma.equipmentUsageFrequency"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="设备综合效率(OEE)">
              <el-input
                style="width: 180px"
                v-model="forma.oee"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="平均无故障工作时间(MTBF)">
              <el-input
                style="width: 180px"
                v-model="forma.mtbf"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="平均修复时间(MTTR)">
              <el-input
                style="width: 180px"
                v-model="forma.mttr"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <div class="divflex">
          <span class="leftx"></span>
          <span class="mainz">管理</span>
          <span class="rightx"></span>
        </div>
        <el-row>
          <el-col :span="6">
            <el-form-item label="区段">
              <el-input
                style="width: 180px"
                v-model="forma.zone"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="工区">
              <el-input
                style="width: 180px"
                v-model="forma.workArea"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="人员">
              <el-input
                style="width: 180px"
                v-model="forma.user"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注">
              <el-input
                v-model="forma.remark"
                type="textarea"
                :autosize="{ minRows: 4, maxRows: 4 }"
                placeholder="请输入内容"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="divflex">
        <span class="leftx"></span>
        <span class="mainz">临时处理标记</span>
        <span class="rightx"></span>
      </div>
      <el-table v-loading="loading1" :data="temporaryList" height="20vh" border>
        <el-table-column label="标记类型" prop="markType" min-width="80"
          ><template #default="scope"
            ><el-input
              v-if="scope.row.addtableShow"
              v-model="scope.row.markType"
              placeholder="请输入" /></template
        ></el-table-column>
        <el-table-column label="标记内容" prop="markContent" min-width="80"
          ><template #default="scope"
            ><el-input
              v-if="scope.row.addtableShow"
              v-model="scope.row.markContent"
              placeholder="请输入" /></template
        ></el-table-column>
        <el-table-column label="标记人" prop="user" min-width="80"
          ><template #default="scope"
            ><el-input
              v-if="scope.row.addtableShow"
              v-model="scope.row.user"
              placeholder="请输入" /></template
        ></el-table-column>
        <el-table-column label="标记时间" prop="markTime" min-width="110"
          ><template #default="scope">
            <el-date-picker
              v-if="scope.row.addtableShow"
              v-model="scope.row.markTime"
              type="datetime"
              placeholder="标记时间"
            /> </template
        ></el-table-column>
        <el-table-column label="备注" prop="remark" min-width="80">
          <template #default="scope"
            ><el-input
              v-if="scope.row.addtableShow"
              v-model="scope.row.remark"
              placeholder="请输入" /></template
        ></el-table-column>
        <el-table-column label="操作" prop="" min-width="80">
          <template #default="scope" class="buttontext">
            <el-button
              v-if="scope.row.addtableShow"
              link
              type="primary"
              @click="addtemporary(scope.row)"
              >添加</el-button
            >
            <el-button
              v-else
              link
              type="primary"
              @click="temporaryDelete(scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <div class="addtablecalss" @click="addtablefun">添加</div>

      <div class="divflex" v-if="title == '参数'">
        <span class="leftx"></span>
        <span class="mainz">修改历史</span>
        <span class="rightx"></span>
      </div>
      <el-table v-if="title == '参数'" :data="historyList" height="20vh" border>
        <el-table-column
          label="序号"
          type="index"
          min-width="80"
        ></el-table-column>
        <el-table-column
          label="指标名"
          prop="property"
          min-width="80"
        ></el-table-column>
        <el-table-column label="变更前指标值" prop="oldValue" min-width="110">
        </el-table-column>
        <el-table-column label="变更后指标值" prop="newValue" min-width="80">
        </el-table-column>
        <el-table-column label="变更时间" prop="createTime" min-width="80">
        </el-table-column>
        <el-table-column label="操作用户名" prop="user" min-width="80">
        </el-table-column>
      </el-table>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="Rail">
import {
  selectManStationFacilityRailListapi,
  insertManStationFacilityRailapi,
  editManStationFacilityRailapi,
  deleteManStationFacilityRailByIdapi,
  selectManBasicRailwayListapi,
  selectManBasicUnitListapi,
  insertManTemporaryDisposeMarkapi,
  selectManTemporaryDisposeMarkListapi,
  deleteManTemporaryDisposeMarkByIdapi,
  selectManRailEditRecordListapi,
  selectManBasicPropertyListapi,
  selectManBasicStationListapi,
  selectManStationFacilityTrackListapi,
  selectManStationFacilityCurveListapi,
  selectManStationFacilitySlopeListapi,
} from "@/api/main/api.js";
import axios from "axios";
import { useContent } from "@/mixin/index.js";
const {
  meansopen,
  meansFun,
  formam,
  closefun,
  resumeUpdate,
  deviceProblem,
  businessFinance,
} = useContent();
import means from "@/components/railmodle/means.vue";
defineExpose({ getList, AparentCount });
const emit = defineEmits(["parentCount", "clearnum"]);

import resume from "@/components/railmodle/resume.vue";
import sleeper from "../offlineDevice/sleeper/index.vue";
import fastening from "../offlineDevice/fastening/index.vue";
import bolt from "../offlineDevice/bolt/index.vue";
// import guardRail from "../offlineDevice/guardRail/index.vue";
import { reactive, ref, toRefs } from "vue";
const route = useRoute();
const router = useRouter();
const { proxy } = getCurrentInstance();
const isShow = ref("钢轨");
const title = ref("新增");
const loading = ref(true);
const loading1 = ref(false);
const open = ref(false);
const resumeopen = ref(false);
const addtableisShow = ref(true);

const data = reactive({
  //股别
  stockTypeobj: [],
  //   所处位置
  locationobj: [],
  //  轨件位置
  railLocationobj: [],
  //  线路类型
  railwayTypeobj: [],
  //  轨距类型
  gaugeTypeobj: [],

  //钢轨单重
  railWeightobj: [],
  // 钢轨材质
  railMaterialobj: [],
  // 钢轨种类
  railTypeobj: [],
  // 钢种
  steelTypeobj: [],
  // 是否再用轨
  railIsAgainobj: [
    {
      value: "是",
      label: "是",
    },
    {
      value: "否",
      label: "否",
    },
  ],
  // 热处理类型
  heatTreatmentTypeobj: [],
  //截面类型
  sectionTypeobj: [],
  railwayNameobj: [],
  unitNameobj: [],
  railList: [],
  forma: {},
  queryParams: {
    pageNum: "1",
    pageSize: "10",
    railwayName: "",
    startMileageNumber: "",
    endMileageNumber: "",
    railCode: "",
    railwayId: "",
    stationName: "",
    railWeight: "",
    stationId: "",
    railWeightId: "",
  },
  rules: {
    unitId: [
      {
        required: true,
        message: "单位名称不能为空",
        trigger: ["blur", "change"],
      },
    ],
    railwayId: [
      { required: true, message: "线名不能为空", trigger: ["blur", "change"] },
    ],
    startMileageNumber: [
      {
        required: true,
        message: "起点里程不能为空",
        trigger: ["blur", "change"],
      },
    ],
    endMileageNumber: [
      {
        required: true,
        message: "终点里程不能为空",
        trigger: ["blur", "change"],
      },
    ],
    stationId: [
      {
        required: true,
        message: "车站名称不能为空",
        trigger: ["blur", "change"],
      },
    ],
    trackId: [
      {
        required: true,
        message: "股道名称不能为空",
        trigger: ["blur", "change"],
      },
    ],
    railCode: [
      {
        required: true,
        message: "钢轨编号不能为空",
        trigger: ["blur", "change"],
      },
    ],
    stockTypeId: [
      { required: true, message: "股别不能为空", trigger: ["blur", "change"] },
    ],
    railWeightId: [
      {
        required: true,
        message: "钢轨单重不能为空",
        trigger: ["blur", "change"],
      },
    ],
    steelTypeId: [
      { required: true, message: "钢种不能为空", trigger: ["blur", "change"] },
    ],
    manufacturingPlant: [
      {
        required: true,
        message: "生产厂不能为空",
        trigger: ["blur", "change"],
      },
    ],
    manufacturingYear: [
      {
        required: true,
        message: "制造年度不能为空",
        trigger: ["blur", "change"],
      },
    ],
    railIsAgain: [
      {
        required: true,
        message: "是否再用轨不能为空",
        trigger: ["blur", "change"],
      },
    ],
  },
  temporaryList: [],
  temporaryId: "",
  editobj: {},
  historyList: [],
  selecttabList: [],
  railwayNamearr: [],
  propertyList: [],
  trackListobj: [],
  stationNameobj: [],
  stationNamearr: [],
  railWeightarr: [],
  slopeList: [],
  stationList: [],
});

const {
  slopeList,
  stationList,
  railWeightarr,
  stationNameobj,
  trackListobj,
  propertyList,
  railwayNamearr,
  stationNamearr,
  selecttabList,
  historyList,
  temporaryId,
  temporaryList,
  railwayNameobj,
  unitNameobj,
  queryParams,
  railWeightobj,
  railList,
  forma,
  stockTypeobj,
  locationobj,
  railLocationobj,
  railwayTypeobj,
  gaugeTypeobj,
  railMaterialobj,
  railTypeobj,
  steelTypeobj,
  railIsAgainobj,
  heatTreatmentTypeobj,
  sectionTypeobj,
  rules,
  editobj,
} = toRefs(data);
//修改记录查询
function historyListfun() {
  selectManRailEditRecordListapi({ equipmentId: editobj.value.id }).then(
    (res) => {
      historyList.value = res.data;
    }
  );
}
function selectiontab(row) {
  selecttabList.value = row;
}
/** 导出按钮操作 */
function handleExport() {
  if (selecttabList.value.length == 0) {
    proxy.$modal.msgError("请选择设备");
    return;
  }
  const arrid = [];
  for (let i = 0; i < selecttabList.value.length; i++) {
    arrid.push(selecttabList.value[i].id);
  }
  proxy.download1(
    "facility-manage/stationFacilityRail/exportExcel",
    arrid,
    `站内钢轨${new Date().getTime()}.xlsx`
  );
}
//标记的添加
function addtemporary(row) {
  // loading1.value = true;
  if (temporaryId.value == "") {
    submitForm(true).then((res) => {
      temporaryId.value = res.data;
      row.railId = res.data;
      insertManTemporaryDisposeMarkapi(row).then((res) => {
        if (res.code == 200) {
          loading1.value = false;
          addtableisShow.value = true;
          queryTemporary(temporaryId.value);
        }
      });
    });
  } else {
    row.railId = temporaryId.value;
    insertManTemporaryDisposeMarkapi(row).then((res) => {
      if (res.code == 200) {
        loading1.value = false;
        addtableisShow.value = true;
        queryTemporary(temporaryId.value);
      }
    });
  }
}
//标记列表
function queryTemporary(rowId) {
  selectManTemporaryDisposeMarkListapi({ railId: rowId }).then((res) => {
    if (res.code == 200) {
      temporaryList.value = res.data;
    }
  });
}
function addtablefun() {
  if (addtableisShow.value) {
    addtableisShow.value = false;
    temporaryList.value.unshift({
      markType: "",
      markContent: "",
      markPeople: "",
      markTime: "",
      remarks: "",
      addtableShow: true,
    });
  }
}
//标记删除
function temporaryDelete(row) {
  console.log(row);
  deleteManTemporaryDisposeMarkByIdapi({ id: row.id }).then((res) => {
    if (res.code == 200) {
      proxy.$modal.msgSuccess("删除成功");
      queryTemporary(row.railId);
    }
  });
}

//参数
function handleUpdate(row) {
  // reset();
  open.value = true;
  row.curveId = "";
  row.slopeId = "";
  editobj.value = JSON.parse(JSON.stringify(row));
  forma.value = JSON.parse(JSON.stringify(row));
  queryTemporary(row.id);
  title.value = "参数";
  historyListfun();
  temporaryId.value = forma.value.id;
  addtableisShow.value = true;
}

const pageNumparent = ref(undefined);
const pageSizeparent = ref(undefined);
const guardRailRef = ref(null);
const sleeperRef = ref(null);
const fasteningRef = ref(null);
const boltRef = ref(null);

//给关联设备传值
function AparentCount(pageNum, pageSize, type) {
  if (type == "轨枕") {
    sleeperRef.value.getList(pageNum, pageSize);
  } else if (type == "扣件") {
    fasteningRef.value.getList(pageNum, pageSize);
  } else if (type == "螺栓") {
    boltRef.value.getList(pageNum, pageSize);
  }
  // else if (type == "桥上护轨") {
  //   guardRailRef.value.getList(pageNum, pageSize);
  // }
}
/** 查询列表 */
function getList(pageNum, pageSize) {
  loading.value = true;
  if (pageNum != undefined || pageSize != undefined) {
    pageNumparent.value = pageNum;
    pageSizeparent.value = pageSize;
    queryParams.value.pageNum = pageNum == undefined ? 1 : pageNum;
    queryParams.value.pageSize = pageSize == undefined ? 10 : pageSize;
  } else {
    queryParams.value.pageNum =
      pageNumparent.value == undefined ? "1" : pageNumparent.value;
    queryParams.value.pageSize =
      pageSizeparent.value == undefined ? "10" : pageSizeparent.value;
  }
  selectManStationFacilityRailListapi(queryParams.value).then((res) => {
    if (res.code == 200) {
      railList.value = res.data;
      const xian = {};
      railwayNamearr.value = railList.value.reduce((next, item) => {
        xian[item.railwayName] == undefined
          ? (xian[item.railwayName] = true & next.push(item))
          : "";
        return next;
      }, []);
      const daoc = {};
      stationNamearr.value = railList.value.reduce((next, item) => {
        daoc[item.stationName] == undefined
          ? (daoc[item.stationName] = true & next.push(item))
          : "";
        return next;
      }, []);
      const ganggdz = {};
      railWeightarr.value = railList.value.reduce((next, item) => {
        ganggdz[item.railWeight] == undefined
          ? (ganggdz[item.railWeight] = true & next.push(item))
          : "";
        return next;
      }, []);
    }
    loading.value = false;
    emit("parentCount", res.count);
  });
}
/** 删除按钮操作 */
function handleDelete(row) {
  proxy.$modal
    .confirm("是否确认删除")
    .then(function () {
      return deleteManStationFacilityRailByIdapi({ id: row.id });
    })
    .then(() => {
      getList();
      proxy.$modal.msgSuccess("删除成功");
    })
    .catch(() => {});
}
getList();
/** 重置操作表单 */
function reset() {
  temporaryId.value = "";
  forma.value = {
    centroidalDistanceBottom: "",
    centroidalDistanceTop: "",
    railwayType: "",
    curveDirection: "",
    curveRadius: "",
    curveTotalLength: "",
    degreeOfInjury: "",
    diseaseLength: "",
    endMitigateLength: "",
    endTangentLength: "",
    equipmentUsageFrequency: "",
    firstInjuryNumber: "",
    gauge: "",
    gaugeType: "",
    healthIndex: "",
    heatTreatmentType: "",
    brokenChainType: "",
    heightLow: "",
    hiddenDangerLevel: "",
    inclination: "",
    inertiaMoment: "",
    lineFacilityCode: "",
    railwayName: "",
    location: "",
    manufacturingPlant: "",
    manufacturingYear: "",
    mtbf: "",
    mttr: "",
    oee: "",
    unitName: "",
    railDirection: "",
    railErpCode: "",
    railIsAgain: "",
    railLength: "",
    railLocation: "",
    railMaterial: "",
    railSilhouette: "",
    railType: "",
    remark: "",
    secondInjuryNumber: "",
    sectionAcreage: "",
    sectionFactor: "",
    sectionType: "",
    sideAbrasionLength: "",
    sleeperAirHangRate: "",
    sleeperDistance: "",
    sleeperFailureRateNumber: "",
    slope: "",
    slopeLength: "",
    startMileageNumber: "",
    endMileageNumber: "",
    startMitigateLength: "",
    startTangentLength: "",
    steeringAngle: "",
    stockType: "",
    strengthOfExtension: "",
    subplateFailureRate: "",
    superelevation: "",
    thirdInjuryNumber: "",
    totalAbrasionLength: "",
    steelType: "",
    user: "",
    verticalAbrasionLength: "",
    workArea: "",
    zone: "",
    railwayId: "",
    unitId: "",
    gaugeTypeId: "",
    locationId: "",
    railwayTypeId: "",
    railWeightId: "",
    railMaterialId: "",
    railTypeId: "",
    steelTypeId: "",
    heatTreatmentTypeId: "",
    sectionTypeId: "",
    stockTypeId: "",
    railLocationId: "",
    stationId: "",
    stationName: "",
    trackId: "",
    trackCode: "",
    standardNumber: "",
    passingWeight: "",
    curveId: "",
    slopeId: "",
  };
  proxy.resetForm("userRef");
}
//修改记录
function updateproperyfun(row, isway) {
  //修改记录无关
  if (isway == true) {
    forma.value.railwayType = "";
    for (let i = 0; i < railwayNameobj.value.length; i++) {
      if (row == railwayNameobj.value[i].id) {
        console.log(railwayNameobj.value[i]);
        forma.value.railwayType = railwayNameobj.value[i].railwayType;
      }
    }
  }
  if (
    forma.value.railwayId != "" &&
    forma.value.trackId != "" &&
    forma.value.stationId != "" &&
    forma.value.startMileageNumber != "" &&
    forma.value.endMileageNumber != ""
  ) {
    selectManStationFacilityCurveListapi({
      railwayId: forma.value.railwayId,
      trackId: forma.value.trackId,
      stationId: forma.value.stationId,
      startMileage: forma.value.startMileageNumber,
      endMileage: forma.value.endMileageNumber,
    }).then((res) => {
      if (res.code == 200) {
        forma.value.curveId = "";
        forma.value.curveDirection = "";
        forma.value.curveRadius = "";
        forma.value.steeringAngle = "";
        forma.value.startTangentLength = "";
        forma.value.startMitigateLength = "";
        forma.value.endMitigateLength = "";
        forma.value.endTangentLength = "";
        forma.value.curveTotalLength = "";
        forma.value.superelevation = "";
        stationList.value = res.data;
        if (stationList.value.length >= 1) {
          forma.value.curveId = stationList.value[0].id;
          forma.value.curveDirection = stationList.value[0].curveDirection;
          forma.value.curveRadius = stationList.value[0].curveRadius;
          forma.value.steeringAngle =
            stationList.value[0].steeringAngleDegree +
            "°" +
            stationList.value[0].steeringAngleMinute +
            "″" +
            stationList.value[0].steeringAngleSecond +
            "″";
          forma.value.startTangentLength =
            stationList.value[0].startTangentLength;
          forma.value.startMitigateLength =
            stationList.value[0].startMitigateLength;
          forma.value.endMitigateLength =
            stationList.value[0].endMitigateLength;
          forma.value.endTangentLength = stationList.value[0].endTangentLength;
          forma.value.curveTotalLength = stationList.value[0].curveTotalLength;
          forma.value.superelevation = stationList.value[0].superelevation;
        }
      }
    });

    selectManStationFacilitySlopeListapi({
      railwayId: forma.value.railwayId,
      trackId: forma.value.trackId,
      stationId: forma.value.stationId,
      startMileage: forma.value.startMileageNumber,
      endMileage: forma.value.endMileageNumber,
    }).then((res) => {
      if (res.code == 200) {
        slopeList.value = res.data;
        forma.value.slopeId = "";
        forma.value.slopeType = "";
        forma.value.slope = "";
        forma.value.slopeLength = "";
        console.log(slopeList.value[0]);
        if (slopeList.value.length >= 1) {
          forma.value.slopeId = slopeList.value[0].id;
          forma.value.slopeType = slopeList.value[0].slopeType;
          forma.value.slope = slopeList.value[0].slopeGradient;
          forma.value.slopeLength = slopeList.value[0].slopeLength;
        }
      }
    });
  }
}
/** 新增按钮操作 */
function handleAdd(row) {
  reset();
  open.value = true;
  title.value = "新增";
  temporaryList.value = [];
  addtableisShow.value = true;
}
/**  提交按钮 */
function submitForm(row) {
  return new Promise((resolve) => {
    proxy.$refs["userRef"].validate((valid) => {
      console.log(valid);
      if (valid) {
        const objold = JSON.parse(JSON.stringify(forma.value));
        if (forma.value.id != undefined) {
          for (const key in editobj.value) {
            for (const keya in forma.value) {
              if (
                key == keya &&
                editobj.value[key] == forma.value[keya] &&
                key != "id"
              ) {
                Reflect.deleteProperty(objold, keya);
              }
            }
          }
          if (
            objold.startMileageNumber != undefined &&
            objold.startMileageNumber != null
          ) {
            objold.startMileageNumber =
              Math.round(objold.startMileageNumber * 1000000) / 1000000;
          }
          if (
            objold.endMileageNumber != undefined &&
            objold.endMileageNumber != null
          ) {
            objold.endMileageNumber =
              Math.round(objold.endMileageNumber * 1000000) / 1000000;
          }
          if (Object.keys(objold).length <= 1) {
            open.value = false;
          } else {
            editManStationFacilityRailapi(objold).then((res) => {
              if (res.code == 200) {
                proxy.$modal.msgSuccess("修改成功");
                historyListfun();
                getList();
                open.value = false;
              }
            });
          }
        } else {
          if (forma.value.startMileageNumber != undefined) {
            forma.value.startMileageNumber =
              Math.round(forma.value.startMileageNumber * 1000000) / 1000000;
          }
          if (forma.value.endMileageNumber != undefined) {
            forma.value.endMileageNumber =
              Math.round(forma.value.endMileageNumber * 1000000) / 1000000;
          }
          insertManStationFacilityRailapi(forma.value).then((res) => {
            if (res.code == 200) {
              resolve(res);
              if (row !== true) {
                proxy.$modal.msgSuccess("新增成功");
                getList();
                open.value = false;
              }
            }
          });
        }
      }
    });
  });
}
/** 取消按钮 */
function cancel() {
  open.value = false;
  reset();
}
/** 查询基础数据-单位数据列表 */
function getList1() {
  selectManBasicRailwayListapi({ hasDelete: 0 }).then((res) => {
    if (res.code == 200) {
      railwayNameobj.value = res.data;
    }
  });
}
getList1();
/** 查询基础数据-单位数据列表 */
function getList2() {
  selectManBasicUnitListapi({ hasDelete: 0 }).then((res) => {
    if (res.code == 200) {
      unitNameobj.value = res.data;
    }
  });
}
getList2();
/** 查询基础数据-车站数据列表 */
function getList3() {
  selectManBasicStationListapi({ hasDelete: 0 }).then((res) => {
    if (res.code == 200) {
      stationNameobj.value = res.data;
    }
  });
}
getList3();
/** 查询基础数据-股道数据列表 */
function getList5() {
  selectManStationFacilityTrackListapi({ hasDelete: 0 }).then((res) => {
    if (res.code == 200) {
      trackListobj.value = res.data;
    }
  });
}
getList5();
/** 查询基础数据-属性维护数据列表 */
function getList4() {
  selectManBasicPropertyListapi({ hasDelete: 0 }).then((res) => {
    if (res.code == 200) {
      propertyList.value = res.data;
      gaugeTypeobj.value = [];
      stockTypeobj.value = [];
      locationobj.value = [];
      railLocationobj.value = [];
      railwayTypeobj.value = [];
      railWeightobj.value = [];
      railMaterialobj.value = [];
      railTypeobj.value = [];
      steelTypeobj.value = [];
      heatTreatmentTypeobj.value = [];
      sectionTypeobj.value = [];
      for (let i = 0; i < propertyList.value.length; i++) {
        if (propertyList.value[i].propertyType == "轨距类型") {
          gaugeTypeobj.value.push(propertyList.value[i]);
        }
        if (propertyList.value[i].propertyType == "股别") {
          stockTypeobj.value.push(propertyList.value[i]);
        }
        if (propertyList.value[i].propertyType == "所处位置") {
          locationobj.value.push(propertyList.value[i]);
        }
        if (propertyList.value[i].propertyType == "轨件位置") {
          railLocationobj.value.push(propertyList.value[i]);
        }
        if (propertyList.value[i].propertyType == "线路类型") {
          railwayTypeobj.value.push(propertyList.value[i]);
        }
        if (propertyList.value[i].propertyType == "钢轨单重") {
          railWeightobj.value.push(propertyList.value[i]);
        }
        if (propertyList.value[i].propertyType == "钢轨材质") {
          railMaterialobj.value.push(propertyList.value[i]);
        }
        if (propertyList.value[i].propertyType == "钢轨种类") {
          railTypeobj.value.push(propertyList.value[i]);
        }
        if (propertyList.value[i].propertyType == "钢种") {
          steelTypeobj.value.push(propertyList.value[i]);
        }
        if (propertyList.value[i].propertyType == "热处理类型") {
          heatTreatmentTypeobj.value.push(propertyList.value[i]);
        }
        if (propertyList.value[i].propertyType == "截面类型") {
          sectionTypeobj.value.push(propertyList.value[i]);
        }
      }
    }
  });
}
getList4();
//轨枕
function sleeperfun(row) {
  forma.value = JSON.parse(JSON.stringify(row));
  isShow.value = "轨枕";
  emit("clearnum", 1, 10);
  // router.push({ path: "/offlineDevice/sleeper" });
}
//扣件
function fasteningfun(row) {
  forma.value = JSON.parse(JSON.stringify(row));
  isShow.value = "扣件";
  emit("clearnum", 1, 10);
  // router.push({ path: "/offlineDevice/fastening" });
}
//螺栓
function boltfun(row) {
  forma.value = JSON.parse(JSON.stringify(row));
  isShow.value = "螺栓";
  emit("clearnum", 1, 10);
  // router.push({ path: "/offlineDevice/bolt" });
}
//桥上护轨
// function guardRailfun(row) {
//   forma.value = JSON.parse(JSON.stringify(row));
//   isShow.value = "桥上护轨";
//   emit("clearnum", 1, 10);
//   // router.push({ path: "/offlineDevice/guardRail" });
// }
function childValue() {
  isShow.value = "钢轨";
  //关联设备的返回
  getList(1, 10);
  emit("clearnum", 1, 10);
}
//查询
function queryList() {
  getList();
}

//重置
function resetQuery() {
  queryParams.value = {
    railwayName: "",
    startMileageNumber: "",
    endMileageNumber: "",
    railCode: "",
    railwayId: "",
    stationName: "",
    railWeight: "",
    stationId: "",
    railWeightId: "",
  };
  getList();
}
</script>

<style scoped lang="scss">
.buttontext {
  .el-button:hover {
    // text-decoration: line-through !important;
  }
}
.divflex {
  height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .leftx {
    width: 45%;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: #e8e8e8;
    margin-top: 3px;
  }
  .mainz {
    font-weight: 400;
    font-style: normal;
    font-size: 16px;
    line-height: 24px;
  }
  .rightx {
    width: 45%;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: #e8e8e8;
    margin-top: 3px;
  }
}
.el-form--inline .el-form-item.formitemcla {
  margin-right: 5px !important;
}
.addtablecalss {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 30px;
  border-width: 1px;
  border-style: dashed;
  cursor: pointer;
}
.el-button--primary.is-link {
  margin-left: 3px;
}
</style>
